#include <iostream>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>

using namespace std;

void handle(int signo)
{
    int n = alarm(0);
    cout << "alarm" <<  n << endl;
    exit(1);
}

int main()
{
    signal(14, handle);
    alarm(10);
    int n = 0;
    while(1)
    {
        cout << "n:" << n++ << endl;
    }
    return 0;
}